package com.summer.shopping.mapper;

import com.summer.shopping.domain.table.ProductCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
* @author 86136
* @description 针对表【product_category(商品分类表)】的数据库操作Mapper
* @createDate 2025-06-20 13:57:18
* @Entity com.summer.shopping.domain/table.ProductCategory
*/
public interface ProductCategoryMapper extends BaseMapper<ProductCategory> {

    /**
     * 查询所有商品分类名字
     * @return
     */
    @Select("select * from product_category")
    List<ProductCategory> selectAllCategory();

    /**
     * 新增商品分类
     * @param productCategory
     */
    @Insert("insert into product_category(category_name,sort_order) values (#{categoryName},#{sortOrder})")
    @Options(useGeneratedKeys = true, keyProperty = "categoryId")
    void saveCategory(ProductCategory productCategory);

    @Delete("delete from product_category where category_id = #{id}")
    void deleteByCategoryId(Long id);
}




